//
// Created by jerry on 2024/5/18.
//
#include "binaryTree.h"
#define Elemtype BinaryTreeNode*
#include "../structure-stack/stack.h"
void PreOrderTraverse(BinaryTree tree,int reverse) {
#ifdef RECURSIVE
#else
    if(reverse==0){
        printf_s("%c\t", tree->data);
        if (tree->left)PreOrderTraverse(tree->left,reverse);
        if (tree->right)PreOrderTraverse(tree->right,reverse);
    }else{
        if (tree->right)PreOrderTraverse(tree->right,reverse);
        if (tree->left)PreOrderTraverse(tree->left,reverse);
        printf_s("%c\t",tree->data);
    }

#endif
}
#ifdef Elemtype
#undef Elemtype
#define Elemtype int
#endif

BinaryTreeNode *initBinaryTreeNode(Elemtype data) {
    BinaryTreeNode *node=NULL;
    MALLOC(node,BinaryTreeNode,1);
    node->data=data;
    node->left=NULL;
    node->right=NULL;
    return node;
}

